<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<html>
  
  <body>
  <% 
  
  	//接受第一个数
  	String s_num1=request.getParameter("num1");
  	
  	//接受第二个数
  	String s_num2=request.getParameter("num2");
  	
  	//接受运算符
  	String flag=request.getParameter("flag");
  	
  	int num1=0;
  	int num2=0;
  	int result=0; 
  	//java中string->int
  	num1=Integer.parseInt(s_num1);
  	num2=Integer.parseInt(s_num2);
  	
  	//计算
  	if(flag.equals("+")) {
  		//加
  		result=num1+num2;
  	}else if(flag.equals("-")){
  		//减
  		result=num1-num2;
  	}else if(flag.equals("*")){
  		//乘
  		result=num1*num2;
  	}else{
  		result=num1/num2;
  	}
  	//输出结果
  	out.println("结果是："+result);
  	
  %>
  
   
  </body>
</html>
